export function transformData(data) {
  const legendData = []
  const radarIndicatorSet = new Set()
  const seriesData = []

  data.forEach(item => {
    legendData.push(item.name)

    const projectScores = JSON.parse(item.projectScore)
    const values = []

    projectScores.forEach(score => {
      radarIndicatorSet.add(score.key)
      values.push(score.value)
    })

    seriesData.push({
      name: item.name,
      value: values
    })
  })

  const radarIndicator = Array.from(radarIndicatorSet).map(key => ({
    name: key
  }))

  return { legendData, radarIndicator, seriesData }
}
